package com.rhb.mail.mail.business;

import java.util.List;

import com.rhb.exception.DuplicateException;
import com.rhb.mail.mail.bean.*;
import com.rhb.mail.mail.dao.MailDAO;


public class MailBusiness_SpringImpl implements MailBusiness {
	
	private MailDAO eDAO;
	
	public MailDAO getMailDAO(){
		return eDAO;
	}
	public void setMailDAO(MailDAO exDAO){
		this.eDAO = exDAO;
	}

	public void erase(Mail ex) {
		this.eDAO.erase(ex);
	}
	public void delete(Mail ex) {
		this.eDAO.delete(ex);
	}
	public Mail findByPk(String pk) {
		return this.eDAO.findByPK(pk);
	}

	public String create(Mail ex) throws DuplicateException{
			return this.eDAO.create(ex);
	}

	public void update(Mail ex)  throws DuplicateException{
			this.eDAO.update(ex);
	}
	//--------
	public List findByQuery(MailQuery qe, int start, int count) {	
		return this.eDAO.findByQuery(qe, start, count);
	}
	
	public int getAllCount_findByQuery(MailQuery qe) {	
		return this.eDAO.getAllCount_findByQuery(qe);
	}

	//------------
	public List findSentMailByQuery(MailQuery query,int start, int count) {	
		return this.eDAO.findSentMailByQuery(query, start, count);
	}
	public int getAllCount_findSentMailByQuery(MailQuery query) {	
		return this.eDAO.getAllCount_findSentMailByQuery(query);
	}

	//---------
	public List findReceivedMailByQuery(MailQuery query,int start, int count) {	
		return this.eDAO.findReceivedMailByQuery(query, start, count);
	}
	
	public int getAllCount_findReceivedMailByQuery(MailQuery query) {	
		return this.eDAO.getAllCount_findReceivedMailByQuery(query);
	}

	//-------------
	public List findUnreadMailByQuery(MailQuery query,int start, int count) {	
		return this.eDAO.findUnreadMailByQuery(query, start, count);
	}
	public int getAllCount_findUnreadMailByQuery(MailQuery query) {	
		return this.eDAO.getAllCount_findUnreadMailByQuery(query);
	}

	//--------------
	public List findDeletedReceivedMailByQuery(MailQuery query,int start, int count){	
		return this.eDAO.findDeletedReceivedMailByQuery(query, start, count);
	}
	public int getAllCount_findDeletedReceivedMailByQuery(MailQuery query) {	
		return this.eDAO.getAllCount_findDeletedReceivedMailByQuery(query);
	}
	//--------------
	public List findDeletedSentMailByQuery(MailQuery query,int start, int count){	
		return this.eDAO.findDeletedSentMailByQuery(query, start, count);
	}
	public int getAllCount_findDeletedSentMailByQuery(MailQuery query) {	
		return this.eDAO.getAllCount_findDeletedSentMailByQuery(query);
	}

	public List findMailsByFatherPk(String pk){
		return this.eDAO.findMailsByFatherPk(pk);
	}
}
